package cn.desk.template.action;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.desk.commons.action.CurdAction;
import cn.desk.commons.entity.PageMode;
import cn.desk.template.entity.Template;

public class TemplateAction<T extends Template> extends CurdAction<T> {

	/**
	 * 
	 */
	
	private static final long serialVersionUID = 1L;
	
	private static final Logger logger=LoggerFactory.getLogger(TemplateAction.class);
	
	private String dependencies;
	public String loadDependencies(){
		logger.debug("loadDependencies start");
		setList(getService().listInByProperty(getEntityClass(),"id",dependencies.split(",")));
		logger.debug("loadDependencies end");
		return "loadDependencies";
	}
	@Override
	public String listPage() {
		logger.debug("listPage start");
		pageMode=service.listPage(pageMode, t,"id");
		logger.debug("listPage end");
		return "listPage";
	}
	@Override
	public List<T> getList() {
		return super.getList();
	}

	@Override
	public Map<String, List<String>> getFieldErrors() {
		return super.getFieldErrors();
	}

	@Override
	public Collection<String> getActionErrors() {
		return super.getActionErrors();
	}

	@Override
	public T getT() {
		return super.getT();
	}

	@Override
	public PageMode<T> getPageMode() {
		return super.getPageMode();
	}

	public String getDependencies() {
		return dependencies;
	}

	public void setDependencies(String dependencies) {
		this.dependencies = dependencies;
	}

	@Override
	public String getModeName() {
		return "template";
	}
}
